package factory

import "errors"

type car interface {
	name() string
}

type benz struct {
	price float64
}

func (b benz) name() string {
	return "benz"
}

type audi struct {
	speed float64
}

func (a audi) name() string {
	return "audi"
}

type carFactory struct {
}

func (cf carFactory) createCar(name string) (car, error) {
	if name == "benz" {
		return benz{}, nil
	}

	if name == "audi" {
		return audi{}, nil
	}

	return nil, errors.New("not supported car type")
}
